﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;

namespace FBPChaos
{
    class Range
    {
        public static int distance(Point originalPoint, Point destination)
        {

            return -1;
        }

        public static Vector2[] path(Point originalPoint, Point destination)
        {
            //y = mx + b
            //x = (y - b) / m
            float y;
            float x;
            float m;
            float b;
            float step = 1.0f;
            //find slope and offset
            m = (originalPoint.Y - destination.Y) / (originalPoint.X / destination.X);
            b = originalPoint.Y - m * originalPoint.X;

            List<Vector2> listOfPoints = new List<Vector2>();

            if (originalPoint.X < destination.X)
                step = 1.0f;
            else
                step = -1.0f;

            //run through all points - x
                for (float counter = (float)originalPoint.X + 0.5f; counter < destination.X + 0.5; counter = counter +step)
                {
                    listOfPoints.Add(new Vector2(counter, m * counter + b));
                }
            
            //run through all points - y
                for (int counter = originalPoint.Y; counter < destination.Y; counter++)
                {
                    listOfPoints.Add(new Vector2((counter - b)/m, counter));
                }
            
            return null;
        }
    }
}
